package com.bsh.serviceImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.bsh.api.ApiUtils;
import com.bsh.api.Exception.ApiException;
import com.bsh.repository.DaoPayment;
import com.bsh.service.ApiPaymentService;
import com.bsh.utils.ApiMessage;
import com.bsh.utils.Constants;
import com.bsh.utils.Des3;

@Service
public class ApiPaymentServiceImpl implements ApiPaymentService {

	@Autowired
	DaoPayment paymentDao;

	@Override
	public ApiMessage getPaymentList(JSONObject dto) throws ApiException {
		ApiMessage msg = new ApiMessage();
		List<Map<String, Object>> list = paymentDao.getPaymentListByUseage(ApiUtils.objIsNotEmpty(dto.getString("useage"))?dto.getString("useage"):null);
		msg.setCode(Constants.REQ_SUCCESS);
		msg.setMessage("支付方式列表");
		Map<String, Object> data = new HashMap<String, Object>();
		data.put("paymentList", list);
		msg.setData(Des3.encResponse(data));
		return msg;
	}

}
